<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('终端型号列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                品牌名称：<select name="manuName" style="width: 220px;">
                                <option value="">选择品牌</option>
                                <option th:each="m:${manufacturer}" th:text="${m.MANU_NAME}" th:value="${m.MANU_NAME}"></option>
                            </select>
                            </li>
                            <li>
                                品牌代号：<select name="manuCode" style="width: 220px;">
                                <option value="">选择品牌</option>
                                <option th:each="mc:${manufacturer}" th:text="${mc.MANU_CODE}" th:value="${mc.MANU_CODE}"></option>
                            </select>
                            </li>
                            <li>
                                <label>终端型号：</label>
                                <input type="text" name="model"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add(500)" shiro:hasPermission="terminal:model:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var terminalTypeDatas = [[${@dict.getType('terminal_type')}]];
        var removeFlag = [[${@permission.hasPermi('terminal:model:remove')}]];
        var prefix = ctx + "terminal/model";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "终端型号",
                columns: [
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'manuCode',
                    title: '品牌代号'
                },
                {
                    field: 'manuName',
                    title: '品牌名称'
                },
                {
                    field: 'model',
                    title: '终端型号'
                },
                {
                    field: 'price',
                    title: '终端价格',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(row.price);
                    },
                    sortable: true
                },
                {
                    field: 'note',
                    title: '备注'
                },
                {
                    field: 'createname',
                    title: '添加人'
                },
                {
                    field: 'createtime',
                    title: '添加时间'
                },
                {
                    field: 'type',
                    title: '终端类型',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(terminalTypeDatas, value);
                    },
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function selectManu() {
            var url = ctx + "terminal/manufacturer/selectManufacturer/";
            $.modal.open("选择厂商" , url, '700');
        }
    </script>
</body>
</html>